cmake_minimum_required(VERSION 3.10.0)
project(gomoku_game VERSION 0.1.0 LANGUAGES C CXX)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 包含目录
include_directories(include)

#======================方法1 start==================
# 创建可执行文件
add_executable(gomoku_game src/main.cpp)

# 添加子目录中的源文件
target_sources(gomoku_game PRIVATE
    src/ai/ai.cpp
    src/board/board.cpp
    src/game/game.cpp
    src/player/player.cpp
)

# 设置目标属性
target_include_directories(gomoku_game PRIVATE
   ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/src/ai
    ${CMAKE_CURRENT_SOURCE_DIR}/src/board
    ${CMAKE_CURRENT_SOURCE_DIR}/src/game
    ${CMAKE_CURRENT_SOURCE_DIR}/src/player
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)
#======================方法1 end==================

#======================方法2 start==================
# 包含所有源文件
# file(GLOB_RECURSE SOURCES "src/*.cpp")
# add_executable(gomoku_game ${SOURCES})

# 包含所有源文件目录
# target_include_directories(gomoku_game PRIVATE
#     ${CMAKE_CURRENT_SOURCE_DIR}/src
# )
#======================方法2 end==================

#======================方法3 start==================
# 创建库目标（推荐用于更大的项目）
# add_library(gomoku_ai STATIC src/ai/ai.cpp)
# add_library(gomoku_board STATIC src/board/board.cpp)
# add_library(gomoku_game_module STATIC src/game/game.cpp)
# add_library(gomoku_player STATIC src/player/player.cpp)

# 设置每个库的包含目录
# target_include_directories(gomoku_ai PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# target_include_directories(gomoku_board PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# target_include_directories(gomoku_game_module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# target_include_directories(gomoku_player PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

# 创建可执行文件并链接库
# add_executable(gomoku_game src/main.cpp)
# target_link_libraries(gomoku_game 
#     gomoku_ai 
#     gomoku_board 
#     gomoku_game_module 
#     gomoku_player
# )

# 设置可执行文件的包含目录
# target_include_directories(gomoku_game PRIVATE
#     ${CMAKE_CURRENT_SOURCE_DIR}/src
#     ${CMAKE_CURRENT_SOURCE_DIR}/include
# )
#======================方法3 end==================

include(CTest)
enable_testing()

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
